package com.cy.common.pojo;

import java.io.Serializable;
import java.util.List;

import lombok.Data;

/**
 * 此类负责封装分页数据信息,设计为泛型是因为好多类都具有分页的功能所以设计为泛型实现复用
 * @author private
 *
 */
@Data
public class SysPage<T> implements Serializable{
	private static final long serialVersionUID = -8946765606956553008L;
	//当前页
	private Integer pageCurrent;
	//总记录条数
	private Integer rowCount;
	//每页显示条数
	private Integer pageSize;
	//总页数
	private Integer pageCount;
	//分页数据信息
	private List<T> records;
	
	public SysPage(Integer pageCurrent,Integer rowCount,Integer pageSize,List<T> records) {
		this.pageCurrent = pageCurrent;
		this.rowCount = rowCount;
		this.pageSize = pageSize;
		this.pageCount = (rowCount-1)/pageSize+1;//计算总页数信息
		this.records = records;
	}
	public SysPage(Integer pageCurrent,Integer rowCount,Integer pageSize,Integer pageCount,List<T> records) {
		this.pageCurrent = pageCurrent;
		this.rowCount = rowCount;
		this.pageSize = pageSize;
		this.pageCount = pageCount;
		this.records = records;
	}
}
